/*
package com.shanjupay.apiagent.controller;


import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

*/
/**
 * 网关接口
 *//*

@Slf4j
@Controller
public class GatewayController {

    @Autowired
    private ClientDetailsService clientDetailsService;

    */
/**
     * 充值页面
     *//*

    @RequestMapping(value="/gateway",method= RequestMethod.GET,params = "serviceName=RECHARGE")
    public ModelAndView recharge(@RequestParam("serviceName") String serviceName ,
                                 @RequestParam("platformNo") String platformNo ,
                                 @RequestParam("signature") String signature ,
                                 @RequestParam("reqData") String depositoryRequest){


        return new ModelAndView("recharge");
    }

    */
/**
     * 提现页面
     *//*

    @RequestMapping(value="/gateway",method= RequestMethod.GET,params = "serviceName=WITHDRAW")
    public ModelAndView withdraw(@RequestParam("serviceName") String serviceName ,
                           @RequestParam("platformNo") String platformNo ,
                           @RequestParam("signature") String signature ,
                           @RequestParam("reqData") String depositoryRequest){


        return new ModelAndView("withdraw");
    }

    @Value("${depository.privateKey}")
    private String depositoryPrivateKey;

    */
/**
     * 回跳至平台
     *//*

    @RequestMapping(value="/redirect",method= RequestMethod.GET)
    public String callbackP2P(@RequestParam("serviceName") String serviceName
            , @RequestParam("platformNo") String platformNo
            , @RequestParam("respData") String respData
            , RedirectAttributes redirectAttributes){

        //TODO:校验和实际处理细节
        ClientDetailsDTO clientDetails = clientDetailsService.getClientDetails(platformNo);
        if(clientDetails == null){
            throw new RuntimeException("平台编码无效");
        }

        String signature = RSAUtil.sign(respData, depositoryPrivateKey,"utf-8");


        redirectAttributes.addAttribute("serviceName",serviceName);
        redirectAttributes.addAttribute("platformNo",platformNo);
        try {
            redirectAttributes.addAttribute("respData", URLEncoder.encode(respData,"utf-8"));
            redirectAttributes.addAttribute("signature",URLEncoder.encode(signature,"utf-8"));
        } catch (UnsupportedEncodingException e) {
            log.error("url编码时出错",e);
        }

        return "redirect:" + clientDetails.getNotifyUrl();

    }

}
*/
